<?php

    class facilityConverter extends CustomCIUnitTestCase {

        private $item;

        public function __construct ()
        {
            parent::__construct ( 'facilityConverter' );
            $this->load->config ( 'data/details' );
        }

        public function setUp ()
        {
            $this->item = array_std ( config_item ( 'details' ) );
        }

        public function tearDown ()
        {
            
        }

        public function test ()
        {

            $total_char = 0;
            $facil = array ();
            $all_attr = array ();


            foreach ( $this->item->facilities as $key => $value ) :
                if ( $value != "" ):

                    $filterSTD = new stdClass;
                    $filterSTD->key = explode ( ',', $value );
                    $filterSTD->title = $key;
                    $filterSTD->cnt = strlen ( str_replace ( ", ", "", $value ) );

                    $facil[$key] = $filterSTD;

                    $total_char += $filterSTD->cnt;

//                    $all_attr[].=explode ( ',', $value );
                    
                    $all_attr = array_merge($all_attr, explode ( ', ', $value ));

                endif;

            endforeach;

//            $this->dump ( $all_attr );
            $this->dump ( 'total char: ' . $total_char );
            $this->dump ( 'group count: ' . count ( $facil ) );
            
            $chunks = array_chunk($all_attr, 2);
            $this->dump ($chunks);
        }

    }

?>